package com.kzx.blog.controller;

import com.kzx.blog.service.IUser;
import com.kzx.blog.service.model.UserLoginParam;
import com.kzx.blog.service.model.UserSO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @author kongz
 * @version 1.0 2021/11/25 17:11
 * @description 用户controller
 */
@RestController
@RequestMapping("/user")
@Api(value = "UserController", tags = {"用户接口"})
public class UserController {

    private final IUser iUser;

    public UserController(IUser iUser) {
        this.iUser = iUser;
    }

    @PostMapping("/login")
    @ApiOperation(value = "用户登录接口",
            notes = "【参数说明】\n" +
                    "account: 账户\n" +
                    "password: 密码\n" +
                    "【结果说明】\n" +
                    "token: 令牌id\n" +
                    "id: 编号\n" +
                    "account: 账户\n" +
                    "name: 昵称\n" +
                    "realName: 真实姓名\n" +
                    "createdTime: 创建时间\n" +
                    "imgUrl: 头像url地址")
    public UserSO login(@RequestBody @Validated UserLoginParam userLoginParam) {
        return iUser.login(userLoginParam);
    }

}
